package com.qf.simpleTrigger;

import com.qf.bean.Users;
import com.qf.dao.UserDao;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

/**
 * IntelliJ IDEA -> springboot120622
 * 2019/12/7 1:37
 *
 * @author zmyao
 * 别看，我是渣渣。
 */
//任务类
    //MySImpleJob是基于反射  创建对象的

public class MySimpleJob implements Job {
    @Autowired
    private UserDao userDao;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        System.out.println("简单触发器："+new Date());
        //再简单触发器中调用方法
        List<Users> users = userDao.findAll();
        for (Users user : users) {
            System.out.println(user);
        }
    }
}
